<template>
  <div class="my-tabs-vertical">
    <div
      v-for="(item, key) in list"
      :key="key"
      class="my-tabs-vertical-item"
      :class="{ active: value == key }"
      @click="handleClickItem(key)"
    >
      <img :src="item.img" alt="" class="image" />
      <div class="label">{{ item.label }}</div>
      <!-- <div class="iconfont icon">&#xe604;</div> -->
      <div v-if="key != Object.keys(list).length" class="line"></div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      default: "1",
    },
    list: {
      default: () => {},
    },
  },
  mounted() {
    console.log(Object.keys(this.list).length, "kkk");
  },
  methods: {
    handleClickItem(key) {
      this.$emit("update:value", key);
    },
  },
};
</script>

<style lang="less" scoped>
.my-tabs-vertical {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;

  .my-tabs-vertical-item {
    position: relative;
    width: 114px;
    height: 100px;
    line-height: 100px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    color: #333;
    font-size: 16px;
    &:nth-child(2) {
      margin: 0 50px;
    }
    .image {
      width: 100%;
      height: 100%;
    }
    .label {
      position: absolute;
      top: 0;
      left: 60%;
      transform: translate(-50%, 0);
      width: 100%;
      font-size: 12px;
    }
    .line {
      position: absolute;
      top: 50%;
      right: -50px;
      transform: translate(0, -50%);
      width: 40px;
      height: 2px;
      background-color: #ccc;
    }
  }

  .active {
    font-weight: bold;
  }
}
</style>